package cn.com.dcsgo.feign;

import cn.com.dcsgo.dto.CartInfoDTO;
import cn.com.dcsgo.feign.fallback.CartFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 购物车 FeignClient
 *
 * @author Dcsgo
 * @since 2025/11/17 14:16
 */
@FeignClient(value = "cart-service", fallback = CartFeignClientFallback.class)
public interface CartFeignClient {

    /**
     * 获取购物车信息列表
     *
     * @param basketIds 购物车ID
     * @return 购物车信息列表
     */
    @GetMapping("rpc/cart/list/ids")
    List<CartInfoDTO> getBasketList(@RequestParam("basketId") List<Long> basketIds);

    /**
     * 批量删除购物车数据
     *
     * @param openid 会员ID
     * @param skuIds 商品sku列表
     * @return true-删除成功，false-删除失败
     */
    @DeleteMapping("rpc/cart/openid/{openid}")
    boolean removeCartItem(@PathVariable("openid") String openid, @RequestParam("skuId") List<Long> skuIds);
}
